home *** CD-ROM | disk | FTP | other *** search
- Path: news.iadfw.net!usenet
- From: Mark Nelson <markn@airmail.net>
- Newsgroups: comp.lang.c
- Subject: Re: assembly code in c ?
- Date: Sun, 17 Mar 1996 17:25:24 -0600
- Organization: customer of Internet America
- Message-ID: <314C9F64.1ECE@airmail.net>
- References: <314C6E40.5111@cs.concordia.ca>
- NNTP-Posting-Host: dal01-02.ppp.iadfw.net
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0GoldB1 (Win95; I)
-
- Aaron H. Chu wrote:
- >
- > Dear netters,
- >
- > I would like to know whether it is possble to embed assembly
- > codes in a c program.
- >
- > What about the problems when writing codes on different
- > platforms ? Do I need to know the register sets well
- > before I attempt to write the program ?
-
- There is no truly portable way to do this. Most compilers allow
- inline assembly, generally using something like the _asm keyword.
- Unfortunately, there is no standard way to perform this. The C++
- spec acknowledges the keyword, but doesn't enforce any sort of
- asm grammar or semantics. So even two compilers that target the
- same platform will do things differently.
-
- Likewise, two compilers from the same vendor that are targeting
- two different platforms will also do things differently.
-
- If you have some inner-inner loop code that is extremely time
- critical, and you feel like it absolutely must be done using
- assembly language, you have no choice but to become well
- acquainted with our good friend Mr. #ifdef.
-
- Mark Nelson
- http://web2.airmail.net/markn
-